package com.niuwa.p2p.service.impl.channel;

import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.niuwa.p2p.core.utils.DictConstant.LOAN_FILE_KIND;
import com.niuwa.p2p.dao.channel.LoanRelativeFileDao;
import com.niuwa.p2p.entity.channel.LoanRelativeFile;
import com.niuwa.p2p.service.channel.ILoanRelativeFileService;
@Service
public class LoanRelativeFileImpl implements ILoanRelativeFileService{
	@Autowired
	private LoanRelativeFileDao loanRelativeDao;
	/**
	 * 借款项目协议文件列表显示
	 * @param projectNo
	 * @return
	 */
	@Override
	public List<LoanRelativeFile> searchLoanRealtiveFileService(String projectNo) {
		return loanRelativeDao.selectByProjectNo(projectNo);
	}
	/**
	 * 保存签署协议文件记录到本地数据库
	 */
	@Override
	public void saveLoanRealtiveFile(String fileID, String fileName,
			String projectNo) {
		LoanRelativeFile loanRealtiveFile=new LoanRelativeFile();
		loanRealtiveFile.setCreateTime(new Date());
		loanRealtiveFile.setFileId(fileID);
		loanRealtiveFile.setFileName(fileName);
		loanRealtiveFile.setLoanFileKind(LOAN_FILE_KIND.COMPLETE.getCode());
		loanRealtiveFile.setProjectNo(projectNo);
		loanRelativeDao.insert(loanRealtiveFile);
	}

}
